#ifndef LIDAR_CELLS_TYPE_H
#define LIDAR_CELLS_TYPE_H
#include <cstdint>
#include <vector>
namespace perception
{
    namespace algorithm
    {
        struct dbscan_config
        {
            float z_eps;
            int min_points_num;
            int search_scope;
        };
        struct track_config
        {
            double max_confidence = 10;   // 最大置信度
            double dconfidence = 1;       // 置信度每次减少比例
            float euclidean_distance = 5; // 欧式距离阈值
            float now_v_ratio = 0.8;      // 上一帧速度的比例
            int max_cluster_size = 100;
            int min_cluster_size = 5;
            int time_eps = 100; // 激光和定位允许的时间误差;
        };
        struct cell_config
        {
            float zmax;
            float zmin;
            float xmin;
            float xmax;
            float ymin;
            float ymax;
            float car_xmin;
            float car_xmax;
            float car_ymin;
            float car_ymax;
            float cell_size_x;
            float cell_size_y;
            float voxel_size;
            float radius_search;
            float threshold_h;
            float min_h;
            float density_10;
            float density_20;
            float density_30;
            float dist10_th;
            float dist20_th;
            float dist30_th;
            float confidence;
            float confidence_;
            float density;
            float intercept;
            int method;
            float obj_height;
            int min_point_num_10;
            int min_point_num_20;
            int min_point_num_30;
            int dist10;
            int dist20;
            int dist30;
            int preprocess_method;
            int search_num;
            int points_num;
            dbscan_config dbscan_config_;
            track_config track_config_;
            void reset()
            {
                zmax = 2.0;
                zmin = -2.0;
                xmin = -20;
                xmax = 40;
                ymin = -15;
                ymax = 15;
                car_xmin = -5.0;
                car_xmax = 0.1;
                car_ymin = -1.5;
                car_ymax = 1.5;
                cell_size_x = 0.5;
                cell_size_y = 0.5;

                method = 2;            // 1 为老方法 2 为引用lidar_obj的预处理 所有点云一起 3 为引用lidar_obj的预处理 单个点云进行
                preprocess_method = 1; // 1-体素栅格滤波+radius+地面分割 2-radius+地面  3-radius
                min_h = 0.1;           // 最小的障碍物高度

                confidence = 0.2;      // confidence 0-50的点云数量对应置信度0-10,得到的比例
                density = 0.0333;      // density 0-30m对应密度为100-1个点
                intercept = 0.03333;   // density 0-30m对应高度为0.3-0m
                confidence_ = 3.0;     // 栅格无效时对应下降速度
                min_point_num_10 = 10; // 十米的点数
                density_10 = 20;       // density = points_num / 体积
                min_point_num_20 = 5;  // 20m的点数
                min_point_num_30 = 0;  // 30m的点数
                density_20 = 10;
                density_30 = 5;
                dist10 = 10; // 第一段距离
                dist20 = 20;
                dist30 = 30;
                dist10_th = 0.2; // 第一段距离的高度阈值
                dist20_th = 0.1;
                dist30_th = 0;
                threshold_h = 0.1;
                radius_search = 0.8; // 搜索半径
                search_num = 10;
                points_num = 0;
                voxel_size = 0.1;
                obj_height = 0; // 距离地面多高算障碍物，针对高度差不满足条件的栅格
            }
        };
        struct data_cell
        {
            double time;
            float x;
            float y;
            float z_intercept;
            float z_min;
            float z_max;
            float z_mean;
            float x_min;
            float x_max;
            float x_mean;
            float y_min;
            float y_max;
            float y_mean;
            float sum;
            float x_sum;
            float y_sum;
            float confidence;
            int vaild;
            int point_num;
            int idx;
            int grid_num;
            void reset()
            {
                idx = -1;
                x = -1;
                y = -1;
                z_intercept = 0;
                z_min = 2;
                z_max = -5;
                z_mean = -2;
                sum = 0;
                x_sum = 0;
                y_sum = 0;
                vaild = 0;
                point_num = 0;
                confidence = -1.0;
                time = 0;
                x_min = 2;
                x_max = -2;
                x_mean = 0;
                y_min = 2;
                y_max = -2;
                y_mean = 0;
                grid_num = 0;
            }
        };
    } // lidar_cells
} // perception

#endif